$OpenBSD: patch-src_channel_c,v 1.5 2015/07/10 17:30:30 dcoppa Exp $

commit c2eec4582ad6f5f759d8b9a3c7f9bf78aa59f656
Author: Felix Morgner <felix.morgner@gmail.com>
Date:   Mon Jul 6 11:20:34 2015 +0200

Fixed mutiple possible null-pointer derefences

--- src/channel.c.orig	Sat Jun 20 00:58:46 2015
+++ src/channel.c	Fri Jul 10 19:01:06 2015
@@ -195,7 +195,7 @@ void Chan_init()
 
 	/* Channel links */
 	for (i = 0; ; i++) {
-		channel_t *ch_src, *ch_dst, *ch_itr = NULL;
+		channel_t *ch_src = NULL, *ch_dst = NULL, *ch_itr = NULL;
 		channellist_t *chl;
 		if (Conf_getNextChannelLink(&chlink, i) < 0) {
 			if (i == 0)
@@ -223,6 +223,8 @@ void Chan_init()
 			ch_dst = ch_itr;
 		
 		chl = malloc(sizeof(channellist_t));
+		if(!chl)
+			Log_fatal("Out of memory");
 		chl->chan = ch_dst;
 		init_list_entry(&chl->node);
 		list_add_tail(&chl->node, &ch_src->channel_links);
@@ -381,6 +383,8 @@ void Chan_buildTreeList(channel_t *ch, struct dlist *h
 	channel_t *sub;
 
 	chl = malloc(sizeof(channellist_t));
+	if(!chl)
+		Log_fatal("Out of memory");
 	chl->chan = ch;
 	init_list_entry(&chl->node);
 	list_add_tail(&chl->node, head);
